<?php
require_once("LoginController.php");
require_once("Database.php");
require_once("RegistrationController.php");
require_once("RegistrationView.php");
require_once("LoginView.php");
require_once("LoginHandler.php");
require_once("RemoveController.php");
require_once("NavigateView.php");
require_once("DBConfig.php");

class MasterController{
	
	public function MasterControl(){

		$registrationview = new RegistrationView();
		$registrationcontroll = new RegistrationController();
		$db = new Database();
		$logincontroller = new LoginController();
		$loginview = new LoginView();
		$loginhandler = new LoginHandler($db);
		$removecontroller = new RemoveController($db);
		$navView = new NavigateView();
		$dbconfig = new DBConfig();
		
		
		if($db->Connect($dbconfig)){
			$control = $logincontroller->DoControll($db);
		$html = $control;
		switch($navView->SwitchController()){
			case NavigateView::RegisterCntrller:
					$html .= $registrationcontroll->RegistrateControll($db);
				break;
			case NavigateView::RemoveCntrller:
					$html .= $removecontroller->RemoveControl();
				break;
			default:
				break;
		}
		$db->close();
		return $html;
					
		}
		
	}
}
?>